<!DOCTYPE html>
<html lang="en">

<head>
	<meta name="auto" content='homo'>
	<meta charset="UTF-8">
	<title>木毛旅行社 -注册</title>
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/base.css">
	<link rel="stylesheet" type="text/css" href="css/login.css">
</head>

<body>
	<header id='header'>
		<div class='center'>
			<nav style='overflow:hidden;'>
				<h2 class="none">网站导航</h2>
				<ul class="link">
					<li><a href="index.html">首页</a></li>
					<li><a href="information.html">旅游咨询</a></li>
					<li><a href="buy.html">机票订购</a></li>
					<li><a href="scenery.html">风景欣赏</a></li>
					<li class="active"><a href="#">登录</a></li>
				</ul>
			</nav>
		</div>
	</header>
	<script>
		function jump() {
			window.location = "login.html";
		}
		function jump_1() {
			window.location = "register.html";
		}

	</script>
	<script>
		function checkEmpty(param1, param2) {
			var inputMessage = ["手机号和邮箱", "密码", "确认密码"]
			var myinputs = document.getElementsByTagName("input")

			for (var i = 0; i < myinputs.length; i++) {
				var tmpInput = myinputs[i]
				if (tmpInput.value === "") {
					alert(inputMessage[i] + "输入的内容不能为空")
					showErrorMessage(inputMessage[i] + "输入的内容不能为空")
					return false;
				}
			}
			return true;

		}
		function success() {

			if (checkEmpty() && checkPwdLength1()) {
				alert('注册成功！');
				jump();
			}


		}
		function checkForm() {
			return checkEmpty() && checkPwdLength();
		}
		function checkPwdLength() {
			var pwdInput = document.getElementById("password")
			var enpwdInput = document.getElementById("enpassword")
			if (pwdInput.value.length < 6) {
				alert("密码的长度不能小于6个字符")
				showErrorMessage("密码的长度不能小于6个字符")
				return false;
			}
			if (enpwdInput.value.length < 6) {
				alert("确认密码的长度不能小于6个字符")
				showErrorMessage("确认密码的长度不能小于6个字符")
				return false;
			}
			if (pwdInput.value !== enpwdInput.value) {
				alert("两次输入的密码不一致");
				showErrorMessage("两次输入的密码不一致");
				return false;
			}
			return false;
		}
		function checkPwdLength1() {
			var pwdInput = document.getElementById("password")
			var enpwdInput = document.getElementById("enpassword")
			if (pwdInput.value.length < 6) {
				return false;
			}
			if (enpwdInput.value.length < 6) {
				return false;
			}
			if (pwdInput.value !== enpwdInput.value) {

				return false;
			}
			return true;
		}
		function showErrorMessage(msg) {
			document.getElementById("errorMsg").innerHTML = "<b>" + msg + "</b>"
			document.getElementById("errorMsg").style.display = "block"
		}
	</script>
	<script>

	</script>
	<form onsubmit="return checkForm()">
		<div id="search">
			<div id="login">
				<div style="text-align: center;"><span id="login_header" onclick="jump()">登录</span><b>·</b><span
						id="login_header1" onclick="jump1()">注册</span></div>
				<div><input class="input" placeholder="手机号或邮箱" type="text"
						style="margin: 0px 40 0px; border-radius: 0px 0px 0px 0px;"></div>
				<div><input class="input" placeholder="密码" id="password" type="text"
						style="margin: 0px auto 0px; border-radius: 0px 0px 4px 4px;"></div>
				<div><input class="input" placeholder="确认密码" id="enpassword" type="text"
						style="margin: 0px auto 0px; border-radius: 0px 0px 4px 4px;"></div>
				<div id="errorMsg">
				</div>
				<div class=""><button class="button_1" style="margin-top: 15%;" onclick="success()">提交</button></div>
				<div class="bottem">点击 “注册” 即表示您同意并愿意遵守
					<a href="www.baidu.com" style="text-decoration: none;">用户协议</a> 和 <a href="www.baidu.com"
						style="text-decoration: none;">隐私政策</a> 。
				</div>
			</div>
		</div>
		<footer id='foot'>
			<div>
				<h1>联系我们</h1>
				<p>电话：13181928266</p>
				<p>邮箱：1501918713@qq.com</p>
				<p>地址：山东省青岛市崂山区青岛大学金家岭校区</p>
			</div>
		</footer>
	</form>